package com.digital.herbarium.Controller;

import com.digital.herbarium.Entity.PopularRead;
import com.digital.herbarium.Entity.ResponseResult;
import com.digital.herbarium.service.PopularReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("read")
public class PopularReadController {

    @Autowired
    PopularReadService popularReadService;

    @PostMapping("/addRead")
    public ResponseResult addRead(PopularRead popularRead) {
        popularReadService.addPopularRead(popularRead);
        return ResponseResult.SUCCESS().setData("添加成功");
    }


    @GetMapping("/getStatReadOrder")
    public ResponseResult getStatRead() {
        return ResponseResult.SUCCESS().setData(popularReadService.getReadOrder());
    }
}
